package net.atomarrow.bs.controller;

import java.util.List;

import net.atomarrow.bs.domain.TbStudent_T;
import net.atomarrow.bs.service.StudentService;
import net.atomarrow.render.Render;
import net.atomarrow.sy.base.BaseController;

public class StudentController extends BaseController {

	private StudentService studentService;
	
	public Render add(){
		TbStudent_T student = new TbStudent_T();
		student.setName("zhangs");
		studentService.add(student);
		student = new TbStudent_T();
		student.setName("lisi");
		studentService.addStudent(student);
		return renderJsonSuccess();
	}
	public Render list1(){
		List<TbStudent_T> students = studentService.listStudents();
		return renderJsonData(students);
	}
	public Render list2(){
		List<TbStudent_T> students = studentService.listStudents2();
		return renderJsonData(students);
	}
	public Render list3(){
		List<TbStudent_T> students = studentService.listStudentsByPage();
		return renderJsonData(students);
	}
	public Render testArray(){
		String array = getParamArrayString("name", ",");
		return renderJson(array);
	}
	public Render addr(){
		TbStudent_T student = getParamObject("student", TbStudent_T.class);
		System.out.println(student.getAddr());
		return renderJsonData(student);
	}
	
	public Render testT(){
		 return null;
	}
}
